import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
/* Layout */
import Layout from '../views/layout/Layout'

import monitorRouter from './modules/monitor'
import diagnosisRouter from './modules/diagnosis'
import predictionRouter from './modules/prediction'
import otherdataRouter from './modules/otherdata'
import serviceRouter from './modules/service'
import configRouter from './modules/config'
import logsRouter from './modules/logs'
import dataOperation from './modules/dataAnalyzation'
import dataEngine from './modules/dataEngine'
import monitoringOverview from './modules/monitoringOverview'

export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/modules/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },
  { path: '/auth/user/register', component: () => import('@/views/modules/auth/user/register'), hidden: true },
  { path: '/auth/user/resetpwd', component: () => import('@/views/modules/auth/user/register'), hidden: true },
  {
    path: '',
    component: Layout,
    redirect: '/index',
    name: 'Index',
    children: [{
      path: 'index',
      meta: { title: '首页', icon: 'dashboard' },
      component: () => import('@/views/modules/dashboard/index')
    }]
  }
]

export const asyncRouterMap = [
  monitorRouter,
  diagnosisRouter,
  predictionRouter,
  monitoringOverview,
  serviceRouter,
  dataOperation,
  dataEngine,
  otherdataRouter,
  configRouter,
  logsRouter,
  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
